import java.util.ArrayList;
import java.util.Scanner;

public class text {
    public static void main(String[] args) {
        ArrayList<Student> cun = new ArrayList<>();
        while(true){
            System.out.println("————————————欢迎来到学生管理系统————————————\n"+
                    "\t1 添加学生\n"+
                    "\t2 删除学生\n"+
                    "\t3 修改学生\n"+
                    "\t4 查看所有学生\n"+
                    "\t5 退出系统");
            Scanner sc = new Scanner(System.in);
            System.out.println("请选择要执行的操作");
            String a = sc.next();
            switch (a){
                case "1":
                    System.out.println("添加学生");
                    add(cun,sc);
                    break;
                case "2":
                    System.out.println("删除学生");
                    break;
                case "3":
                    System.out.println("修改学生");
                    break;
                case "4":
                    System.out.println("查看所有学生");
                    break;
                case "5":
                    System.out.println("退出系统");
                    break;
                default:
                    System.out.println("无此选项，请重新选择");
            }
        }
    }

    private static void add(ArrayList<Student> cun,Scanner sc) {
        for (int i = 0; i <cun.size(); i++) {
            System.out.println("请输入要添加的学号");
            String a = sc.next();
            Student x = cun.get(i);
            if (a.equals(x.getID())) {
                System.out.println("该学号已存在，请重新输入");
                return;
            }

        }
    }
}
